<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>11_2_1-通过配置的方式进行数据请求</title>
</head>

<body>
    <!--载入vue.js-->
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <div id="Application">
        您的名字是：{{data.name}} <br />
        您的ID是：{{data.id}}<br />
        您的年龄是：{{data.age}}<br />
        您的性别是：{{data.sex}}<br />
        <ul v-for="item in data.list">
            <li>{{item}}</li>
        </ul>
    </div>
    <script>
        const app = Vue.createApp({
            setup() {
                //存储拿到的数据
                const data = Vue.ref("");
                axios({
                    method: "get",
                    url: "https://rouse.npc.ink/api/data.php",
                })
                    .then((response) => {
                        data.value = response.data;
                        console.log(response.data);
                    });



                return { data };

            },
        })

        app.mount("#Application")
    </script>
</body>

</html>